package com.xbjtech.mapper;

import com.xbjtech.model.Permission;
import com.xbjtech.model.PermissionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface PermissionMapper {
    
	@Select("select DISTINCT(t4.id) id, t4.name,t4.param,t4.descript  from t_user_role t1 left join t_role t2 on t1.role_id = t2.id left join t_role_permission t3 on t2.id = t3.role_id left join t_permission t4 on t3.permission_id = t4.id where t1.user_id = #{id}")
	List<Permission> selectPermissionsByUserId(Long id);
	
	long countByExample(PermissionExample example);

    int deleteByExample(PermissionExample example);

    int deleteByPrimaryKey(Long id);

    int insert(Permission record);

    int insertSelective(Permission record);

    List<Permission> selectByExampleWithBLOBs(PermissionExample example);

    List<Permission> selectByExample(PermissionExample example);

    Permission selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example);

    int updateByExampleWithBLOBs(@Param("record") Permission record, @Param("example") PermissionExample example);

    int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example);

    int updateByPrimaryKeySelective(Permission record);

    int updateByPrimaryKeyWithBLOBs(Permission record);

    int updateByPrimaryKey(Permission record);
}